package com.jiangjiang.eshop.finance.service.impl;

import com.jiangjiang.eshop.finance.dto.PurchaseSettlementOrderDTO;
import com.jiangjiang.eshop.finance.service.FinanceFacadeService;
import com.jiangjiang.eshop.finance.service.PurchaseSettlementOrderService;
import com.jiangjiang.eshop.wms.convert.PurchaseInputOrderConvert;
import com.jiangjiang.eshop.wms.dto.PurchaseInputOrderDTO;
import com.jiangjiang.eshop.wms.dto.ReturnGoodsInputOrderDTO;
import com.jiangjiang.eshop.wms.dto.SaleDeliveryOrderDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.rmi.runtime.Log;

/**
 * @Author Jianghaowen
 * @Date 2021/9/14
 * @Description: TODO
 * @Version V1.0
 **/
@Slf4j
@Service
public class FinanceFacadeServiceImpl implements FinanceFacadeService {

    @Autowired
    private PurchaseInputOrderConvert purchaseInputOrderConvert;
    @Autowired
    private PurchaseSettlementOrderService purchaseSettlementOrderService;

    @Override
    public Boolean createPurchaseSettlementOrder(PurchaseInputOrderDTO purchaseInputOrderDTO) {
       try {
           PurchaseSettlementOrderDTO dto = purchaseInputOrderConvert.convert2PurchaseSettlementOrderDTO(purchaseInputOrderDTO);
           purchaseSettlementOrderService.saveSettlementOrder(dto);
           return true;
       }catch (Exception e){
           log.warn("FinanceFacadeServiceImpl createPurchaseSettlementOrder error",e);
       }
        return false;
    }

    @Override
    public Boolean payForLogisticsCompany(SaleDeliveryOrderDTO saleDeliveryOrderDTO) {
        return false;
    }

    @Override
    public Boolean executeReturnGoodsRefund(ReturnGoodsInputOrderDTO returnGoodsInputOrderDTO) {
        return false;
    }
}
